package com.yunji.cabinet.dao.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yunji.cabinet.bo.FillCargoQueryBO;
import com.yunji.cabinet.bo.FillCargoSelectBO;
import com.yunji.cabinet.dao.IFillCargoInfoDao;
import com.yunji.cabinet.domain.FillCargoInfoDO;
import com.yunji.cabinet.mapper.IFillCargoInfoMapper;
import com.yunji.common.base.BaseDaoImpl;
import com.yunji.common.utils.bean.BeanUtils;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Project: yunji-coffee
 * @Package: com.yunji.cabinet.dao.impl
 * @Title: FillCargoInfoDaoImpl
 * <p>
 * History:
 * Date                     Version     Author          Summary
 * ============================================================
 * 2024-11-01 15:15:50      V1.0        HuaAo       新建类
 */
@Repository
public class FillCargoInfoDaoImpl extends BaseDaoImpl<IFillCargoInfoMapper, FillCargoInfoDO> implements IFillCargoInfoDao {

    @Override
    public FillCargoInfoDO select(FillCargoSelectBO bo) {
        return getOne(new LambdaQueryWrapper<FillCargoInfoDO>()
                .eq(BeanUtils.isNotNull(bo.getMaintainId()),FillCargoInfoDO::getMaintainId,bo.getMaintainId())
                .eq(BeanUtils.isNotNull(bo.getOrdinal()),FillCargoInfoDO::getOrdinal,bo.getOrdinal()));
    }

    @Override
    public List<FillCargoInfoDO> search(FillCargoQueryBO param) {
        return list(new LambdaQueryWrapper<FillCargoInfoDO>()
                .eq(BeanUtils.isNotNull(param.getMaintainCode()),FillCargoInfoDO::getMaintainCode,param.getMaintainCode())
                .eq(BeanUtils.isNotNull(param.getMaintainId()),FillCargoInfoDO::getMaintainId,param.getMaintainId()));
    }
}